//
// Created by hay boy on 2022/6/19.
//

#ifndef ALGORITHMS_CIRCULARLISTWITHHEADER_H
#define ALGORITHMS_CIRCULARLISTWITHHEADER_H
#include "ExtendedChain.h"
/**
 * 带头结点的循环链表，不带尾指针
 * **/
template<class T>
class CircularListWithHeader:public ExtendedChain<T>{
public:
    CircularListWithHeader();
    ~CircularListWithHeader();
    int indexOf(const T& theElement) const;
    T& get(int theIndex)const;
    void erase(int theIndex);
    void insert(int theIndex,const T& theElement);
    void output(ostream& out) const;
    void clear();
    void push_back(const T& theElement);
    template<class Y>
    friend ostream &operator<<(ostream &out, const CircularListWithHeader<Y> &x);
protected:
    ChainNode<T>* headerNode;
};
#endif //ALGORITHMS_CIRCULARLISTWITHHEADER_H
